import Store from 'electron-store';

const store = new Store();

let uid: any = null;

const initUserId = (_uid: any) => {
  uid = _uid;
}

const setData = (key: any, value: unknown) => {
  store.set(key, value);
}

const getData = (key: any) => {
  return store.get(key);
}

const setUserData = (key: any, value: unknown) => {
  setData(uid + key, value);
}

const getUserData = (key: any) => {
  return getData(uid + key);
}

const getUserId = () => {
  return uid;
}

const deleteUserData = (key: any) => {
  store.delete(uid + key)
}
export default {
  initUserId,
  setData,
  getData,
  setUserData,
  getUserData,
  getUserId,
  deleteUserData,
}
